﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class AspNetPaperList_getQuery : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write(Request.QueryString.ToString());
        Cah();
    }


    protected void Cah()
    {
        int [] 无精 ={299, 331, 330, 329, 328 };
        int [] 死精 = {298, 327, 326, 325, 324 };
        int[] 少精 = { 297, 323, 322, 321, 320 };
        int[] 精子成活率低 = { 296, 319, 318, 317, 316 };
        string [] cc = {"","来源" ,"常识" , "预防" ,  "治疗" };
        for (int i = 1; i < 无精.Length; i++)
        {
            if (i == 1)
            {
                Response.Write("declare @num int\r\n");
                Response.Write("declare @numMain int\r\n");
                Response.Write("delete [CX_Column] where [CX_Column_id] = " + 死精[0] + " --删除 " + cc[i] + "\r\n");
                Response.Write("delete [CX_NEWS_Class] where [CX_Column_id] = " + 死精[0] + " --删除 " + cc[i] + "\r\n");
                Response.Write("update [CX_Column] Set [CX_Column_Name] = '精子异常 ' where [CX_Column_id] =  "+无精[0]+"--更新名字\r\n");//更新无精的名字
            }

            Response.Write("select @num =  [CX_NEWS_Class_id] from [CX_NEWS_Class] where [CX_Column_id] = " + 死精[i] + " -- 得到" + cc[i] + " 新闻分类ID\r\n");
            Response.Write("select @numMain =  [CX_NEWS_Class_id] from [CX_NEWS_Class] where [CX_Column_id] = " + 无精[i] + " -- 得到" + cc[i] + " 新闻分类ID\r\n");
            Response.Write("update [CX_NEWS_Class] Set [CX_NEWS_Class_Name] = '精子异常 "+cc[i]+"' where [CX_Column_id] =  "+无精[i]+"--更新名字\r\n");//更新无精的名字
            Response.Write("update [CX_NEWS] Set [CX_NEWS_Class_id] = @numMain  where [CX_NEWS_Class_id] = @num -- 更新到 " + cc[i] + "\r\n");
            Response.Write("delete [CX_Column] where [CX_Column_id] = " + 死精[i] + " --删除 " + cc[i] + "\r\n");
            Response.Write("delete [CX_NEWS_Class] where [CX_Column_id] = " + 死精[i] + " --删除 " + cc[i] + "\r\n");



            if (i == 1)
            {

                Response.Write("delete [CX_Column] where [CX_Column_id] = " + 少精[0] + " --删除 " + cc[i] + "\r\n");
                Response.Write("delete [CX_NEWS_Class] where [CX_Column_id] = " + 少精[0] + " --删除 " + cc[i] + "\r\n");
            }

            Response.Write("select @num =  [CX_NEWS_Class_id] from [CX_NEWS_Class] where [CX_Column_id] = " + 少精[i] + " -- 得到" + cc[i] + " 新闻分类ID\r\n");
            Response.Write("select @numMain =  [CX_NEWS_Class_id] from [CX_NEWS_Class] where [CX_Column_id] = " + 无精[i] + " -- 得到" + cc[i] + " 新闻分类ID\r\n");
            Response.Write("update [CX_NEWS_Class] Set [CX_NEWS_Class_Name] = '精子异常 " + cc[i] + "' where [CX_Column_id] =  " + 无精[i] + "--更新名字\r\n");//更新无精的名字
            Response.Write("update [CX_NEWS] Set [CX_NEWS_Class_id] = @numMain  where [CX_NEWS_Class_id] = @num -- 更新到 " + cc[i] + "\r\n");
            Response.Write("delete [CX_Column] where [CX_Column_id] = " + 少精[i] + " --删除 " + cc[i] + "\r\n");
            Response.Write("delete [CX_NEWS_Class] where [CX_Column_id] = " + 少精[i] + " --删除 " + cc[i] + "\r\n");



            if (i == 1)
            {

                Response.Write("delete [CX_Column] where [CX_Column_id] = " + 精子成活率低[0] + " --删除 " + cc[i] + "\r\n");
                Response.Write("delete [CX_NEWS_Class] where [CX_Column_id] = " + 精子成活率低[0] + " --删除 " + cc[i] + "\r\n");
            }

            Response.Write("select @num =  [CX_NEWS_Class_id] from [CX_NEWS_Class] where [CX_Column_id] = " + 精子成活率低[i] + " -- 得到" + cc[i] + " 新闻分类ID\r\n");
            Response.Write("select @numMain =  [CX_NEWS_Class_id] from [CX_NEWS_Class] where [CX_Column_id] = " + 无精[i] + " -- 得到" + cc[i] + " 新闻分类ID\r\n");
            Response.Write("update [CX_NEWS_Class] Set [CX_NEWS_Class_Name] = '精子异常 " + cc[i] + "' where [CX_Column_id] =  " + 无精[i] + "--更新名字\r\n");//更新无精的名字
            Response.Write("update [CX_NEWS] Set [CX_NEWS_Class_id] = @numMain  where [CX_NEWS_Class_id] = @num -- 更新到 " + cc[i] + "\r\n");
            Response.Write("delete [CX_Column] where [CX_Column_id] = " + 精子成活率低[i] + " --删除 " + cc[i] + "\r\n");
            Response.Write("delete [CX_NEWS_Class] where [CX_Column_id] = " + 精子成活率低[i] + " --删除 " + cc[i] + "\r\n");

            

		
			

         

        }



        

    }
    /*
 无精 299

    来源 331

    常识 330

    预防 329

    治疗 328

死精 298

    来源 327

    常识 326

    预防 325

    治疗 324

少精 297

    来源 323

    常识 322

    预防 321

    治疗 320

精子成活率低 296

    来源 319

    常识 318

    预防 317

    治疗 316


     */
}
